#include "stdafx.h"
#include "RenderObject.h"
#include "RenderSystem.h"
#include "TextureManager.h"
#include "ShaderManager.h"
#include <fstream>

RenderObject::RenderObject(void)
{
}


RenderObject::~RenderObject(void)
{
}

bool RenderObject::Create(RenderSystem* render_system, Texture* texture, Shader* shader, Renderable* renderable)
{
	m_texture = texture;
	m_shader = shader;
	m_renderable = renderable;

	/*int vs_s[]={sizeof(OncePerFrame), sizeof(OncePerObject)};
	int ps_s[]={sizeof(DirectionalLight)};
	m_shader->AllocateVSConstants(2,vs_s);
	m_shader->AllocatePSConstants(1,ps_s);
	render_system->CreateConstantBuffers(m_shader);

	Sampler sampler;
	render_system->CreateSamplerState(&sampler,AM_WRAP,AM_WRAP,AM_WRAP,FM_LINEAR,CM_NEVER);
	m_shader->AllocateSamplers(1);
	m_shader->SetSampler(0,sampler);

	D3D10_INPUT_ELEMENT_DESC desc[]={
		{"POSITION",0,DXGI_FORMAT_R32G32B32_FLOAT,0,0,D3D10_INPUT_PER_VERTEX_DATA,0},
		{"TEXCOORD",0,DXGI_FORMAT_R32G32_FLOAT,0,12,D3D10_INPUT_PER_VERTEX_DATA,0},
		{"NORMAL",0,DXGI_FORMAT_R32G32B32_FLOAT,0,20,D3D10_INPUT_PER_VERTEX_DATA,0}
	};

	render_system->CreateInputLayout(m_shader,desc,3);*/

	render_system->CreateDepthState(&m_depth);
	render_system->CreateRasterizerState(&m_rasterizer,CULL_NONE,FILL_SOLID);

	return true;
}